<?php
include("xml_document.php");

$XML = new xml_document("my_xml");

$FirstNode = $XML->addNode("myNode");
$FirstNode->addAttribute("attributename","value");
$FirstNode->addNode("hierarchyNode","MyValue");

$XML->save("path_to_save");
echo $XML->content();

?>